<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: legion
  Date: 2021/10/15
  Time: 20:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加</title>
    <script type="text/javascript" src="/resource/js/jquery-3.2.1.js"></script>
    <link rel="stylesheet" href="/resource/css/index3.css">
</head>
<body>

<form action="update" method="post">
    <input type="hidden" name="id" value="${apply.id}">
    学生姓名:<input type="text" name="name" value="${apply.name}">
    性别:<input type="radio" name="gender" ${apply.gender==0?'checked':''}  value="0">男
        <input type="radio" name="gender" ${apply.gender==1?'checked':''} value="1">女
        <br>

    出生日期:<input type="text" name="birthday" value="<fmt:formatDate value="${apply.birthday}" pattern="yyyy-MM-dd"></fmt:formatDate>">
    联系电话:<input type="text" name="phone" value="${apply.phone}"><br>

    专业:<select name="majorid">
    <option value="">--请选择--</option>
    <c:forEach items="${list}" var="m">
        <option value="${m.id}" ${m.id==apply.majorid?'selected':''}>${m.name}</option>
    </c:forEach>
</select>

    <br>

    住宿费:<input type="text" name="accommodation" value="${apply.accommodation}">
    报名费:<input type="text" name="applyfee" value="${apply.applyfee}">
    <br>
    <input type="button" value="保存" onclick="add()">
</form>
<script >
    function add() {
        $.post("update",$("form").serialize(),function (result) {
            if (result){
                alert("保存成功")
                location="list";
            }else {
                alert("保存失败")
            }
        })
    }
</script>
</body>
</html>
